<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app" class="out">
        <div class="top">
            vue实训-注册功能
            <img src="images/830086299943768487.png"/>
       </div>
    
        <div class="text">
            <input type="text" v-model="loginName" placeholder="请输入用户名"/>
        </div>
    
        <div class="text">
            <input type="text" v-model="pwd"  placeholder="请输入密码"/>
        </div>

        <div class="text">
            <input type="text" v-model="name"  placeholder="请输入姓名"/>
        </div>
    
        <div class="buttom" @click="reg">
            注册
       </div>

    </div>
</body>
<script>
    var vm=new Vue({
        el:'#app',
        data:{
            loginName:'',
            pwd:'',
            name:''
        },
        methods:{
            login(){
                $.ajaxSetup({
                    contentType:"application/json;charset=utf-8"
                });
                var data={'loginName':this.loginName,'pwd':this.pwd}
                $.post("http://api.tutestudio.net/api/login",JSON.stringify(data),function(res){
                    if(res.code==200){
                        alert('登录成功')
                        location.href='home.html'
                    }
                    else{
                        alert('登录失败')
                    }
                })           }
        }
    })
</script>
</html>